package com.crm.dao;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.crm.entity.POConfirm;
import com.crm.util.ApplicationContext;

public class POConfirmDAO {

	protected final Log logger = LogFactory.getLog(getClass());
	static Transaction tx;
	public  int insert(POConfirm c) throws Exception{
		Session session =  ApplicationContext.getHiberSession().openSession();
		Transaction tx=null;
		try {
			tx = session.beginTransaction();
			session.saveOrUpdate(c);
			tx.commit();
			return 0;
		}
		catch (Exception e) {
			if (tx!=null) tx.rollback();
			throw e;
		}
		finally {
			session.close();
		}
	}
}
